<template>
  <div>
    <h1>useStore方法操作vuex4</h1>
    <h2>{{ store.state.counter.count }}</h2>
    <button @click="increment">同步+2</button>
    <button @click="incrementyb">异步+5</button>
  </div>
</template>

<script lang='ts' setup>
import {useStore} from 'vuex'
const store=useStore()
console.log('store',store);
const increment=()=>{
    store.commit('counter/INCREMENT',2)
}
const incrementyb=()=>{
    store.dispatch("counter/incrementAsync",5)
}

</script>

<style lang='scss' scoped>
</style>